package com.sikaryofficial.backend.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sikaryofficial.backend.domain.dto.req.points.GuideTaskReq;
import com.sikaryofficial.backend.domain.entity.GuideTaskDetail;
import com.sikaryofficial.backend.mapper.GuideTaskDetailMapper;
import com.sikaryofficial.backend.service.IGuideTaskDetailService;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class GuideTaskDetailService extends ServiceImpl<GuideTaskDetailMapper, GuideTaskDetail> implements IGuideTaskDetailService {

	@Override
	public GuideTaskDetail saveGuideTask(GuideTaskReq guideTaskReq) {
		Long userId = guideTaskReq.getUserId();
		// 查询指定任务
		GuideTaskDetail guideTaskDetail = new GuideTaskDetail();
		guideTaskDetail.setTaskCode(guideTaskReq.getTaskCode());
		guideTaskDetail.setCreatedBy(userId);
		guideTaskDetail.setCreatedTime(new Date());
		this.save(guideTaskDetail);
		return guideTaskDetail;
	}
}
